/**
 * 
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.CommentDAO;
import com.sesame.domain.Comment;

/**
 * @author voidman
 * 
 */
public class CommentDAOImpl extends SqlMapClientDaoSupport implements CommentDAO {

    public void addComment(Comment Comment) {
        getSqlMapClientTemplate().insert("addComment", Comment);
    }

    public void deleteCommentById(Integer id) {
        getSqlMapClientTemplate().delete("deleteCommentById", id);
    }

    @SuppressWarnings("unchecked")
    public List<Comment> getAllComment() {
        List<Comment> listComment;
        listComment = getSqlMapClientTemplate().queryForList("getAllComment");
        return listComment;
    }
    
    public Comment getCommentById(Integer id) {

        return (Comment) getSqlMapClientTemplate().queryForObject("getCommentById", id);
    }

    public void updateComment(Comment Comment) {
        getSqlMapClientTemplate().update("updateComment", Comment);
    }

}
